From 17fa8783527fcbfb7624889cdf5de12375517924 Mon Sep 17 00:00:00 2001
From: Andrey Shertsinger <andrey@shertsinger.ru>
Date: Thu, 14 May 2015 14:18:46 +0600
Subject: [PATCH] Fix for support virtual domain user names

---
 sendxmpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sendxmpp b/sendxmpp
index 0d7c4ff..7045c16 100755
--- a/sendxmpp
+++ b/sendxmpp
@@ -355,8 +355,10 @@ sub xmpp_login ($$$$$$$$$$$$) { # {{{
 
     # use the xmpp domain as the host and enable SRV lookups
 	if (!$host) {
-		if ($user =~ /@(.*)/) {
-			$arghash->{hostname} = $host = $1;
+		if ($user =~ /([\.\w_#-]+)@(.*)/) {
+			$arghash->{hostname} = $host = $2;
+			$arghash->{componentname} = $2;
+			$user = $1;
 			$arghash->{srv} = 1;
 			debug_print "enabling SRV lookups";
 
